package org.zero.concurrency.demo.filter;

import org.zero.concurrency.demo.example.threadlocal.RequestHolder;

import javax.servlet.*;
import java.io.IOException;

/**
 * @program: concurrency-demo
 * @description:
 * @author: 01
 * @create: 2018-10-17 15:54
 **/
public class HttpFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        RequestHolder.add(Thread.currentThread().getId());
        chain.doFilter(request, response);
    }

    @Override
    public void destroy() {

    }
}
